import service from "../index"
import baseUrl from "./base"
import { StoreManageListSubmitDataType,BasicInformationFormDatatype } from "../../viewModel/storeManagement/storeManagement"

// 店铺管理列表数据分页查询
export const getShopQuery = (data: StoreManageListSubmitDataType) => {
    return service({
        method: "POST",
        url: baseUrl.SHOPINFO_PAGE_QUERY,
        data: data
    })
}

// 店铺类型查询
export const getShopType = () => {
    return service({
        url: baseUrl.SHOPINFO_SHOP_TYPE
    })
}

// 通过主键查询基础信息
export const getSelectBaseInfo = (shopId:number) => {
    return service({
        url: baseUrl.SHOPINFO_SELECT_ONE_BASEINFO,
        params: {
            shopId: shopId
        }
    })
}

// 通过主键查询法人信息
export const getSelectLegalPerson = (shopId:number) => {
    return service({
        url: baseUrl.SHOPINFO_SELECT_ONE_LEGAL_PERSON,
        params: {
            shopId: shopId
        }
    })
}

// 通过主键查询店铺地址信息
export const getSelectShopAddress = (shopId:number) => {
    return service({
        url: baseUrl.SHOPINFO_CREATE_SHOP_ADDRESS,
        params: {
            shopId: shopId
        }
    })
}

// 新增店铺基本信息
export const createShop = (data:BasicInformationFormDatatype) => {
    return service({
        method: "POST",
        url: baseUrl.SHOPINFO_CREATE_SHOP,
        headers: {
            showTips: true
        },
        data: data
    })
}

// 更新店铺基本信息
export const upDateShop = (data:BasicInformationFormDatatype) => {
    return service({
        method: "POST",
        url: baseUrl.SHOPINFO_UPDATE_SHOP,
        headers: {
            showTips: true
        },
        data: data
    })
}